/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mapeClient;


/**
 *
 * @author marco
 */
public class ServiceFactory {
    
    
    private ServiceFactory(){
    }
    
    private static ServiceFactory instance = null;
    
    public synchronized static ServiceFactory getInstance(){
        if(instance==null) {
            instance = new ServiceFactory();
        }
        return instance;
    }
    
    public ServiceProxy getProxy(String name, TransmissionParameter parameters){
        if(name.equalsIgnoreCase("tcp")) {
            return new TCPServiceProxy(parameters.getIpAddress(), parameters.getPort());
        }else if(name.equalsIgnoreCase("udp")){
            return new UDPServiceProxy(parameters.getIpAddress(), parameters.getPort());
        } 
        
        return null;
    }
    
}
